
function find(num) {
    let count = 0;//计数
    let arr = [];//不超过n开方的整数平方集合
    for (let i = 0; i * i <= num; i++) {
        arr.push(i * i);
    }
    console.log(arr);
    let sum = 0;
    for (let i = arr.length - 1; i >= 0; i--) {

        while (sum < num) {
            sum += arr[i];
            count++;
        }
        if (sum == num) {
            break;
        }

    }
    return count;
}


console.log(find(13));
console.log(find(16));